import DisplayObjectModel from "./DisplayObjectModel";
import cjs=createjs
export default class ContainerModel {
  name:string;
  children:cjs.DisplayObject[];
  visible:boolean;
  x:number;
  y:number;
  scaleX:number;
  scaleY:number;
  rotation:number;
  alpha:number;
  skewX:number;
  skewY:number;
  static create(data:string|any):ContainerModel{
    let json:any
        if(typeof data === 'string'){
            json=JSON.parse(data)
        }else{
            json=data
        }
        const model=new ContainerModel()
        model.name=json.name
        model.children=json.children.map(item=>DisplayObjectModel.create(item))
        model.visible=json.visible
        model.x=json.x
        model.y=json.y
        model.scaleX=json.scaleX
        model.scaleY=json.scaleY
        model.rotation=json.rotation
        model.alpha=json.alpha
        model.skewX=json.skewX
        model.skewY=json.skewY
        return model
  }
}